package org.example.service.application.impl;

import org.example.domain.entity.SysPermission;
import org.example.service.application.SysPermissionApplicationService;
import org.example.service.domain.SysPermissionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

@Service
public class SysPermissionApplicationServiceImpl implements SysPermissionApplicationService {
    @Resource
    private SysPermissionService sysPermissionService;

    @Override
    public List<String> selectPermissionByUserId(Long userId) {
        List<SysPermission> permissionList = sysPermissionService.selectPermissionByUserId(userId);
        return permissionList.stream()
                .map(SysPermission::getPermissionKey)
                .collect(Collectors.toList());
    }
}
